package com.gee.spring.boot.influxdb.core.query.segment;

import static com.gee.spring.boot.influxdb.core.constant.StrConstant.*;
import static com.gee.spring.boot.influxdb.core.enums.SqlKeyword.FILL;

/**
 * @author gepengjun
 * @since 2024/4/29 14:08
 */
public class FillSegment implements ISqlSegment {

    private Object fillValue;

    private Boolean byFunc = false;

    @Override
    public String getSqlSegment() {
        if (!byFunc && fillValue instanceof String){
            return FILL.getKeyword() + LEFT_BRACKET + SINGLE_QUOTE + fillValue + SINGLE_QUOTE + RIGHT_BRACKET;
        }
        return FILL.getKeyword() + LEFT_BRACKET + fillValue + RIGHT_BRACKET;
    }

    public void setFillValue(Object fillValue) {
        this.fillValue = fillValue;
    }

    public Object getFillValue() {
        return fillValue;
    }

    public Boolean getByFunc() {
        return byFunc;
    }

    public void setByFunc(Boolean byFunc) {
        this.byFunc = byFunc;
    }
}
